using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class StasisEffectController:MonoBehaviour {

	SpriteRenderer spriteRenderer;
	SpriteRenderer parent;
	public float alpha;

	private void OnEnable() {
		if(!spriteRenderer)
			spriteRenderer=GetComponent<SpriteRenderer>();

		spriteRenderer.material.SetVector("offset",Random.insideUnitCircle);

	}

	private void Update() {
		parent=transform.parent.GetComponent<SpriteRenderer>();
		if(parent) {
			spriteRenderer.sprite=parent.sprite;
			spriteRenderer.flipX=parent.flipX;
			spriteRenderer.flipY=parent.flipY;
		} else {
			spriteRenderer.sprite=null;
		}
		transform.localPosition=Vector3.zero;
		transform.localRotation=Quaternion.identity;
		transform.localScale=Vector3.one;
		spriteRenderer.color=new Color(1,1,1,alpha);
	}

}
